<!doctype html>
<html>

<head>
	<meta charset="utf-8">
	<title>我的订单</title>
	<% include  ../template/commonCss.ejs %>
	<link href="<%=resUrl%>/css/order/index.css" rel="stylesheet" type="text/css" />
	<% include ../template/commonJs.ejs %>
	<% include ../template/chatLister.ejs %>
	<script>
		var orderStates= '<%-orderState || -1%>';
	</script>
</head>

<body ontouchstart> 
		<% var topTitle = '我的订单';var topReturnType = '';var returnUrl = '/my_shop' %>
		<% include ../template/topReturn.ejs %>
	<div class="weui-tab">
		<!-- <div class="order-sousuo"><i class="iconfont icon-sousuo"></i>　</div> -->
		<div class="tabs" <%if(locals.token && token != ''){%>style="top:0;"<%}%>>
			<a class="item last <%if(orderState==-1){%>current<%}%>" href="javascript:" data-state="-1"> 
				全部
				<div class="v-line"></div>
			</a>
			<a class="item last <%if(orderState==10){%>current<%}%>" href="javascript:" data-state="10">
				待发货
				<div class="v-line"></div>
			</a>
			<a class="item last <%if(orderState==31){%>current<%}%>" href="javascript:" data-state="31">
				待退款
				<div class="v-line"></div>
			</a>
			<a class="item last <%if(orderState==30){%>current<%}%>" href="javascript:" data-state="30">
				待评价
				<div class="v-line"></div>
			</a>
			<a class="item last <%if(orderState==40){%>current<%}%>" href="javascript:" data-state="40">
				已完成
				<div class="v-line"></div>
			</a>
		</div>
		<div id="aroundBox" <%if(locals.token && token != ''){%>style="top:0.2rem;"<%}%>>
			<div class="weui-pull-to-refresh__layer" style="padding: 5px;">
				<div class="weui-pull-to-refresh__arrow"></div>
				<div class="weui-pull-to-refresh__preloader"></div>
				<div class="down">下拉刷新</div>
				<div class="up">释放刷新</div>
				<div class="refresh">正在刷新</div>
			</div>
			<div id="contentTo" >
				<!-- content -->
			</div>
			<div class="weui-loadmore" id="loadmore">
				<i class="weui-loading"></i>
				<span class="weui-loadmore__tips">正在加载</span>
			</div>
			<div class="weui-loadmore weui-loadmore_line" style="display:none;" id="nomore">
				<span class="weui-loadmore__tips">全部加载完毕</span>
			</div>
			
			</div>
		</div>	
	</div>	
			
	<script id="content" type="text/html">
		{{each list}}
		<div class="shoplist-item">
			<div class="shoplist-item-top">	
				<img class="shoplist-item-logo" src="{{$value.userDetail.photo}}" alt="">
				<span>{{$value.userDetail.name }}
				{{if $value.state == 0}}
				<div class="order-top-rig order-top-orange">待付款</div>
				{{else if $value.state == 10}}
				<div class="order-top-rig order-top-orange">待发货</div>
				{{else if $value.state == 20}}
				<div class="order-top-rig order-top-orange">待收货</div>
				{{else if $value.state == 30}}
				<div class="order-top-rig order-top-orange">待评价</div>
				{{else if $value.state == 31}}
				<div class="order-top-rig order-top-orange">申请退款中</div>
				{{else if $value.state == 32}}
				<div class="order-top-rig order-top-orange">退款中</div>
				{{else if $value.state == 33}}
				<div class="order-top-rig order-top-orange">拒绝退款</div>
				{{else if $value.state == 34}}<!--退款成功-->
				<div class="order-top-rig">交易关闭</div>
				{{else if $value.state == 40}}
				<div class="order-top-rig">交易完成</div>
				{{else if $value.state == 99}}
				<div class="order-top-rig">交易关闭</div>
				{{/if}}
			</div>
			<a href="javascript:visitUrl('/order/sellerDetail?id={{$value.id}}',true)">
				<div class="shoplist-item-body">
					<div class="order-body-let" style="width:1.68rem;height:1.68rem;background: url({{$value.productDetail.coverImage}}?x-oss-process=image/resize,w_500) no-repeat 0 center;background-size: 100% auto;border:1px solid #DDDDDD;">
					</div>	
					<div class="order-body-cen">
						<div class="order-pro-name">{{$value.productDetail.name}}</div>
						<div class="auto-height"></div>
						{{if $value.tradeType  == 1}}
						<div class="order-img order-img-pai"></div>
						{{/if}}
						{{if $value.shopDetail.marginAuthentication == 1}}
						<div class="order-img order-img-bao"></div>
						{{/if}}
					</div>	
					<div class="order-body-rig">
							<div>￥{{$value.productDetail.price}}</div>
							<div class="order-pro-number">x{{$value.productDetail.count}}</div>
					</div>	
					<div class="auto-height"></div>
					<div class="order-count" >共{{$value.productDetail.count}}件商品  合计:{{$value.payMoney}}</div>	
				</div>
			</a>
			<div class="order-bottom" >
					{{if $value.state == 0}}
					<!-- 未付款 -->
					<div class="order-bots order-bots-orange" onclick="upPrice('{{$value.id}}',1);">修改价格</div>
					{{else if $value.state == 10}}
					<!-- 待发货 -->
					<!-- <div class="order-bots order-bots-orange" onclick="sureDeliver('{{$value.id}}');">确认发货</div> -->
					<div class="order-bots order-bots-orange" onclick="logistics('{{$value.id}}','{{$value.receiveDetail ?$value.receiveDetail.logisticsCode:''}}','{{$value.receiveDetail?$value.receiveDetail.logisticsNo :''}}');">确认发货</div>
					{{else if $value.state == 20}}
					<!-- 待收货 -->
					{{else if $value.state == 30}}
					<!-- 已收货 -->
					{{else if $value.state == 31}}
					<!-- 申请退款（待确认） -->
					<a href="javascript:visitUrl('/order/refundDetail?id={{$value.id}}&isSeller=true',true)">
						<div class="order-bots order-bots-orange" >退款详情</div>
					</a>
					<div class="order-bots order-bots-orange" onclick="opRefund('{{$value.id}}',1);">确认退款</div>
					<div class="order-bots order-bots-orange" onclick="opRefund('{{$value.id}}',2);">拒绝退款</div>
					{{else if $value.state == 32}} <!-- 卖家 -->
					<div class="order-bots order-bots-orange" onclick="finishRefund('{{$value.id}}');">完成退款</div> 
					{{else if $value.state == 33}}
					<!-- 买家退货（待收货） -->
					{{else if $value.state == 34}}
					<!-- 卖家收货 -->
					
					{{else if $value.state == 40}}
					<!-- 已评价 -->
					{{else if $value.state == 99}}
					<!-- 交易关闭 -->
					{{/if}}
			</div>	
		</div>
		{{/each}}
	</script>		
	<script type="text/javascript" src="<%=resUrl%>/js/order/sellerList.js"></script>
</body>

</html>